package com.zr.serviceimpl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zr.dao.ShowGuoFanPriceDao;
import com.zr.model.Cdisstation;
import com.zr.service.ShowGuoFanPriceService;

import net.sf.json.JSONArray;
import net.sf.json.JSONObject;
@Service("shgufaprse")
public class ShowGuoFanPriceServiceImpl implements ShowGuoFanPriceService{
	@Resource
	private ShowGuoFanPriceDao shgufaprdaim;
	@Override
	public JSONObject getFanPrice(int page, int rows, int uid) {
		JSONObject jo=new JSONObject();
		JSONArray ja=new JSONArray();
		
		List<Cdisstation> li=shgufaprdaim.findFanPrice(page, rows, uid);
		
		for (Cdisstation cdisstation : li) {
			
			JSONObject j=new JSONObject();
			j.put("disid",cdisstation.getDisid());
			
			j.put("disname",cdisstation.getDisname());
			j.put("cuser",cdisstation.getCuser().getUname());
			j.put("disscope",cdisstation.getDisscope());
			j.put("disprice",cdisstation.getDisprice());
			j.put("fkgc",cdisstation.getFkgc());
			j.put("subkilogramme",cdisstation.getSubkilogramme());
			j.put("mtm",cdisstation.getMtm());
			ja.add(j);
		}
		jo.put("rows",ja);
		jo.put("total", shgufaprdaim.getcount());
		return jo;
	}

}
